package com.ghy.component;

import com.ghy.service.UserService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author GaoHeYang
 */

@Slf4j
@Component
public class XxlJobTask {

    @Autowired
    private UserService userService;

    @XxlJob(value = "statistics")
    public void statistics() throws Exception{
        Map<String, Object> result = userService.statistics();

        log.info(result.toString());
        XxlJobHelper.handleSuccess("今日数据统计完毕");

    }
}
